#ifndef _PROJ4_H
#define _PROJ4_H

#include <coordinate_transformation.h>

// proj4 includes
#include <proj.h>
#include <stdio.h>

#include <iostream>
#include <string>

namespace common {
class Proj4 : public CoordinateTransformation {
public:
    Proj4() = delete;
    Proj4(const std::string sour_EPSG, const std::string des_EPSG);
    ~Proj4();
    void Init();
    void Start();
    void Stop();

    /**
     * @brief FWD 是前向转换，就是从源坐标系向目标坐标系转换
     * 
     * @param Long 
     * @param Lat 
     * @param Easting 
     * @param Northing 
     * @return true 
     * @return false 
     */
    bool FWD(const double &Long, const double &Lat,
        double *Easting, double *Northing);
    
    /**
     * @brief INV 是逆向转换, 就是从目标坐标系向源坐标系转换
     * 
     * @param Easting 
     * @param Northing 
     * @param Long 
     * @param Lat 
     * @return true 
     * @return false 
     */
    bool INV(const double &Easting,
        const double &Northing, double *Long, double *Lat);

private:
    // variables
    /* proj4 variables
     */
    PJ_CONTEXT *C;
    PJ *P;
    std::string sour_EPSG_;
    std::string des_EPSG_;
};
}  // namespace common

#endif  // PROJ4_7_2_1_H
